<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
    /**
    * Code Igniter
    *
    */

    // ------------------------------------------------------------------------

    /**
    * Code Igniter JSON ENCODE helper
    *
    * @package		CodeIgniter
    * @subpackage	Helpers
    * @category		Helpers
    * @author       Ivan Kukic < ikukic@yahoo.com >
    */

    // ------------------------------------------------------------------------


    /**
    * General Asset Helper
    *
    * Helps to engode json request
    * also create content form HTML to valid JSON
    *
    * @access		public
    * @param		string    the name of the file or asset
    * @param		string    the asset type (name of folder)
    * @param		string    optional, module name
    * @return		string    full url to asset
    */

    function json_encode_get($data)
    {
        if(isset($_GET['jsoncall'])) {

            /*$data = preg_replace(
            array('/\n/','/\r/','/\t/'),
            array(''),
            $data); */
            echo $_GET['jsoncall'] . '(' . json_encode(array('jsonp'=>$data)) . ');';

        }else {
            echo json_encode(array('json',$data));
        }
    }


?>